import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '../views/layout'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: Layout,
    redirect:'/home',
    children:[
      {
        path:'home',
        meta:{title:'首页'},
        name:'myHome',
        component:()=>import(/* webpackChunkName: "home" */ '../views/home/index.vue')
      },
      {
        path:'super',
        meta:{title:'管理员页面'},
        name:'super',
        component:()=>import(/* webpackChunkName: "super" */ '../views/super/index.vue')
      }
    ]
  },
  {
    path:'/pms',
    name:'pms',
    meta:{title:'商品'},
    component:Layout,
    redirect:'/pms/product',//重定向
    children:[
      {
        path:'product',
        name:'product',
        meta:{title:'商品列表'},
        component:()=>import(/* webpackChunkName: "product" */ '../views/pms/product/index.vue')
      },
      {
        path:'productadd',
        name:'productadd',
        meta:{title:'添加商品'},
        component:()=>import(/* webpackChunkName: "productadd" */ '../views/pms/product/add.vue')
      },
      {
        path:'productupdate/:id',
        name:'productupdate',
        mata:{title:'修改商品'},
        component:()=>import(/* webpackChunkName: "productupdate" */ '../views/pms/product/update.vue')
      },
      {
        path:'productAttr',
        name:'productAttr',
        meta:{title:'商品类型'},
        component:()=>import(/* webpackChunkName: "productAttr" */ '../views/pms/productAttr/index.vue')
      },
      {
        path:'productCate',
        name:'productCate',
        meta:{title:'商品分类'},
        component:()=>import(/* webpackChunkName: "productCate" */ '../views/pms/productCate/index.vue')
      },
      {
        path:'productCateAdd',
        name:'productCateAdd',
        meta:{title:'添加商品分类'},
        component:()=>import(/* webpackChunkName: "productCateAdd" */ '../views/pms/productCate/add.vue')
      },
      {
        path:'productCateupdate/:id',
        name:'productCateupdate',
        meta:{title:'商品分类更新'},
        component:()=>import(/* webpackChunkName: "productCateupdate" */ '../views/pms/productCate/update.vue')
      },
      {
        path:'brand',
        name:'brand',
        meta:{title:'品牌列表'},
        component:()=>import(/* webpackChunkName: "brand" */ '../views/pms/brand/index.vue')
      },
      {
        path:'brandAdd',
        name:'brandAdd',
        meta:{title:'品牌添加'},
        component:()=>import(/* webpackChunkName: "brandAdd" */ '../views/pms/brand/add.vue')
      },
      {
        path:'brandUpdate/:id',
        name:'brandUpdate',
        meta:{title:'品牌更新'},
        component:()=>import(/* webpackChunkName: "brandUpdate" */ '../views/pms/brand/update.vue')
      },
    ]
  },
  {
    path: '/login',
    name: 'Login',
    meta:{title:'登录'},
    component: () => import(/* webpackChunkName: "login" */ '../views/login')
  },
  {
    path:'*',
    name:'page404',
    meta:{title:'404页'},
    component:() => import(/* webpackChunkName: "page404" */ '../views/page404')
  }
]

const router = new VueRouter({
  routes
})

export default router
